﻿using System;
using System.Threading;
using System.Threading.Tasks;

namespace TaskAndThread
{
    class Program
    {
        static void Main(string[] args)
        {
            int threadId = Thread.CurrentThread.ManagedThreadId;
            Console.WriteLine("当前线程的ID是：" + threadId);
            TestthreadId();
            Console.ReadLine();
        }

        private static async void TestthreadId()
        {
            await Task.Delay(1000);
            int threadId = Thread.CurrentThread.ManagedThreadId;
            Console.WriteLine("方法中的线程的ID是：" + threadId);
        }
    }
}
